<style>
    body {
        padding: 0;
        overflow: hidden;
    }

    .btn {
        border: 1px solid #eaeaea;
        padding: 4px 8px;
        margin: 10px 14px;
        display: block;
        color: #797979;
    }

    .btn:first-child {
        margin: 0 14px 10px 14px;
    }

    .btn:last-child {
        margin: 10px 14px 0 14px;
    }

</style>
<#include "/resource-nopace.ftl"/>
<div >
    <input type="hidden" name="projectId" value="${project.id}">

    <div class="input-group">
        <span class="input-group-addon">项目名称</span>
        <input type="text" name="name" value="${project.name}" class="form-control" placeholder="请输入项目名称">
    </div>
    <div class="input-group" style="margin-top: 8px;">
        <span class="input-group-addon">安全域名</span>
        <input type="text" name="domain" value="${project.domain}" class="form-control" placeholder="请输入安全域名">
    </div>
</div>
<div style="padding-top: 16px">
    <a class="btn btn-primary  btn-block" onclick="submit(this)" style="margin: 0;">提交</a>
</div>
<script>
    function submit(e) {
        var name = $('input[name="name"]').val();
        var projectId = $('input[name="projectId"]').val();
        var domain = $('input[name="domain"]').val();
        $.ajax({
            url: '/project/update',
            type: "POST",
            data: JSON.stringify({name: name, projectId: projectId,domain:domain}),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (result) {
                if (result.code == 0) {
                    parent.window.location.reload();
                } else {
                    //錯誤提示
                }
            }
        })
    }
</script>